package com.llp.declaresystem.mapper;

import com.llp.declaresystem.domain.dto.UserDto;
import com.llp.declaresystem.domain.entity.Expert;
import com.llp.declaresystem.domain.entity.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
* @author NASK
* @description 针对表【user(统一登录用户信息表)】的数据库操作Mapper
* @createDate 2022-11-23 16:22:57
* @Entity com.llp.declaresystem.entity.User
*/
@Mapper
public interface UserMapper extends BaseMapper<User> {

    /**
     * 通过username查询用户信息
     * @param username
     * @return
     */
    @Select("select uid,gid from user where username=#{username};")
    Map identityByUsername(String username);

    /**
     * 通过uid修改用户密码
     * @param user
     * @return
     */
    @Update("update user set password = #{newPassword} where uid = #{uid}")
    int updatePwdByUid(UserDto user);

    @Select("select * from user where uid=#{uid}")
    User selectByUid(Integer uid);

}




